package com.kcyu.sfhinvoice.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * 
 * @TableName invoice_struct
 */
@TableName(value ="invoice_struct")
@Data
public class InvoiceStruct implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 发票关联ID
     */
    private Integer invoiceId;

    /**
     * 文件ID
     */
    private Integer fileId;

    /**
     * 发票代码
     */
    private String invoiceCode;

    /**
     * 发票校验码
     */
    private String checkCode;

    /**
     * 发票日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") // 解决时区问题
    private Date invoiceDate;

    /**
     * 买方税号
     */
    private String purchaserRegisterNum;

    /**
     * 发票发行机构
     */
    private String invoiceTypeOrg;

    /**
     * 发票金额
     */
    private BigDecimal amountInFiguers;

    /**
     * 复核人
     */
    private String checker;

    /**
     * 不含税金额
     */
    private BigDecimal totalAmount;

    /**
     * 总税额
     */
    private BigDecimal totalTax;

    /**
     * 城市
     */
    private String city;

    /**
     * 省份
     */
    private String province;

    /**
     * 买方
     */
    private String purchaserName;

    /**
     * 发票类型
     */
    private String invoiceType;

    /**
     * 开票人
     */
    private String noteDrawer;

    /**
     * 卖方地址
     */
    private String sellerAddress;

    /**
     * 卖方税号
     */
    private String sellerRegisterNum;

    /**
     * ocr原始结果
     */
    private String ocrOrigin;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") // 解决时区问题
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") // 解决时区问题
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        InvoiceStruct other = (InvoiceStruct) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInvoiceId() == null ? other.getInvoiceId() == null : this.getInvoiceId().equals(other.getInvoiceId()))
            && (this.getFileId() == null ? other.getFileId() == null : this.getFileId().equals(other.getFileId()))
            && (this.getInvoiceCode() == null ? other.getInvoiceCode() == null : this.getInvoiceCode().equals(other.getInvoiceCode()))
            && (this.getCheckCode() == null ? other.getCheckCode() == null : this.getCheckCode().equals(other.getCheckCode()))
            && (this.getInvoiceDate() == null ? other.getInvoiceDate() == null : this.getInvoiceDate().equals(other.getInvoiceDate()))
            && (this.getPurchaserRegisterNum() == null ? other.getPurchaserRegisterNum() == null : this.getPurchaserRegisterNum().equals(other.getPurchaserRegisterNum()))
            && (this.getInvoiceTypeOrg() == null ? other.getInvoiceTypeOrg() == null : this.getInvoiceTypeOrg().equals(other.getInvoiceTypeOrg()))
            && (this.getAmountInFiguers() == null ? other.getAmountInFiguers() == null : this.getAmountInFiguers().equals(other.getAmountInFiguers()))
            && (this.getChecker() == null ? other.getChecker() == null : this.getChecker().equals(other.getChecker()))
            && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
            && (this.getTotalTax() == null ? other.getTotalTax() == null : this.getTotalTax().equals(other.getTotalTax()))
            && (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity()))
            && (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince()))
            && (this.getPurchaserName() == null ? other.getPurchaserName() == null : this.getPurchaserName().equals(other.getPurchaserName()))
            && (this.getInvoiceType() == null ? other.getInvoiceType() == null : this.getInvoiceType().equals(other.getInvoiceType()))
            && (this.getNoteDrawer() == null ? other.getNoteDrawer() == null : this.getNoteDrawer().equals(other.getNoteDrawer()))
            && (this.getSellerAddress() == null ? other.getSellerAddress() == null : this.getSellerAddress().equals(other.getSellerAddress()))
            && (this.getSellerRegisterNum() == null ? other.getSellerRegisterNum() == null : this.getSellerRegisterNum().equals(other.getSellerRegisterNum()))
            && (this.getOcrOrigin() == null ? other.getOcrOrigin() == null : this.getOcrOrigin().equals(other.getOcrOrigin()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInvoiceId() == null) ? 0 : getInvoiceId().hashCode());
        result = prime * result + ((getFileId() == null) ? 0 : getFileId().hashCode());
        result = prime * result + ((getInvoiceCode() == null) ? 0 : getInvoiceCode().hashCode());
        result = prime * result + ((getCheckCode() == null) ? 0 : getCheckCode().hashCode());
        result = prime * result + ((getInvoiceDate() == null) ? 0 : getInvoiceDate().hashCode());
        result = prime * result + ((getPurchaserRegisterNum() == null) ? 0 : getPurchaserRegisterNum().hashCode());
        result = prime * result + ((getInvoiceTypeOrg() == null) ? 0 : getInvoiceTypeOrg().hashCode());
        result = prime * result + ((getAmountInFiguers() == null) ? 0 : getAmountInFiguers().hashCode());
        result = prime * result + ((getChecker() == null) ? 0 : getChecker().hashCode());
        result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
        result = prime * result + ((getTotalTax() == null) ? 0 : getTotalTax().hashCode());
        result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode());
        result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode());
        result = prime * result + ((getPurchaserName() == null) ? 0 : getPurchaserName().hashCode());
        result = prime * result + ((getInvoiceType() == null) ? 0 : getInvoiceType().hashCode());
        result = prime * result + ((getNoteDrawer() == null) ? 0 : getNoteDrawer().hashCode());
        result = prime * result + ((getSellerAddress() == null) ? 0 : getSellerAddress().hashCode());
        result = prime * result + ((getSellerRegisterNum() == null) ? 0 : getSellerRegisterNum().hashCode());
        result = prime * result + ((getOcrOrigin() == null) ? 0 : getOcrOrigin().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", invoiceId=").append(invoiceId);
        sb.append(", fileId=").append(fileId);
        sb.append(", invoiceCode=").append(invoiceCode);
        sb.append(", checkCode=").append(checkCode);
        sb.append(", invoiceDate=").append(invoiceDate);
        sb.append(", purchaserRegisterNum=").append(purchaserRegisterNum);
        sb.append(", invoiceTypeOrg=").append(invoiceTypeOrg);
        sb.append(", amountInFiguers=").append(amountInFiguers);
        sb.append(", checker=").append(checker);
        sb.append(", totalAmount=").append(totalAmount);
        sb.append(", totalTax=").append(totalTax);
        sb.append(", city=").append(city);
        sb.append(", province=").append(province);
        sb.append(", purchaserName=").append(purchaserName);
        sb.append(", invoiceType=").append(invoiceType);
        sb.append(", noteDrawer=").append(noteDrawer);
        sb.append(", sellerAddress=").append(sellerAddress);
        sb.append(", sellerRegisterNum=").append(sellerRegisterNum);
        sb.append(", ocrOrigin=").append(ocrOrigin);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}